
import 'package:flutter/material.dart';

/// stack_demo.dart
///

void main() => runApp(const MaterialApp(home: DemoStackWidget(),));

class DemoStackWidget extends StatelessWidget {
  const DemoStackWidget({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('ch14 stack demo')),
      body: Stack(
        children: [
          Container(color: Colors.yellow, width: 300, height: 300,),
          Positioned(
            left: 18.0, top: 18.0,
            child: Container(color: Colors.green, width: 50, height: 50,)
          ),
          const Positioned(
            left: 18.0, top: 70.0,
            child: Text('Stack提供了层叠布局的容器', style: TextStyle(fontSize: 19.0),),
          )
        ],
      ),
    );
  }
}

